import { baseURL, http } from '../conf'
import store from '@/store'
import qs from 'qs'

/*************************************** 页面接口API *******************************************/
// GET 请求
export const getTopLevel = (params = {}) => {
  return http.get(`${baseURL}/head/get_info`, { params }).then(res => res.data)
}

// POST 请求
export const modifyTopLevelInfo = (params = {}) => {
  return http.post(`${baseURL}/head/modify`, qs.stringify(params)).then(res => res.data)
}
/*************************************** 图片上传 *******************************************/

// 图片上传oss
export const uploadCropIMG = (params = {}) => {
  return http.post(`${baseURL}/material/import_img`, params, {
    headers: { 'Content-Type': 'multipart/form-data' }
  }).then(res => res.data)
}
// 图片上传oss
export const uploadIMG = (params = {}) => {
  return http.post(`${baseURL}/material/import_img`, params, {
    headers: { 'Content-Type': 'multipart/form-data' }
  }).then(res => res.data)
}
// 删除图片
export const deleteIMG = (params = {}) => {
  return http.post(`${baseURL}/material/delete_img`, qs.stringify(params)).then(res => res.data)
}
// 导入
export const uploadRecipe = (params = {}) => { // 文件上传
  return http.post(`${baseURL}/meal/import_excel`, params, {
    headers: {'Content-Type': 'multipart/form-data'}
  }).then(res => res.data)
}

/*************************************** 食安监管 *******************************************/

/*************************************** 食安监管 标准化接口*******************************************/

// 食安监管 - 标准化查询数据
export const businessListSearch = (params = {}) => {
	return http.post(`${baseURL}/api/parameter/standard_business/list`,(params),{
		headers:{ 'Content-Type':'application/json'}
	}).then(res => res.data);
};
  
// 食安监管 - 标准化修改数据
export const businessListEdit = (params = {}) => {
	return http.post(`${baseURL}/api/parameter/standard_business/edit`,(params),{
		headers:{ 'Content-Type':'application/json'}
	}).then(res => res.data);
};
  
// 食安监管 - 标准化新增数据
export const businessListSave = (params = {}) => {
	
	return http.post(`${baseURL}/api/parameter/standard_business/save`,(params),{
		headers:{ 'Content-Type':'application/json'}
	}).then(res => res.data);
};
  
// 食安监管 - 标准化删除数据
export const businessListDelete = (params = {}) => {
	return http.post(`${baseURL}/api/parameter/standard_business/delete`,(params),{
		headers:{ 'Content-Type':'application/json'}
	}).then(res => res.data);
};

// 食安监管 - 标准化详情数据
export const businessListDetail = (params = {}) => {
	return http.post(`${baseURL}/api/parameter/standard_business/get`,(params),{
		headers:{ 'Content-Type':'application/json'}
	}).then(res => res.data);
};

// 食安监管 -  获取消毒台账列表
export const getDisinfectAccount = (params = {}) => {
	return http.get(`${baseURL}/api/device_all/disinfection_record/query`, { params }).then((res) => res.data)
}

// 获取消毒模式列表
export const getDisinfectModeList = (params = {}) => {
	return http
		.get(`${baseURL}/api/device_all/disinfect_pattern/list`, { params })
		.then((res) => res.data)
}
// 留样台账列表
export const getSamplesDailyList = (params = {}) => {
	return http
		.get(`${baseURL}/api/standing_fridge/pc/keep/query_list`, { params })
		.then((res) => res.data)
}